package com.spzx.JUC2.test7;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ExecutorsDemo01 {
    public static void main(String[] args) {

        //获取线程池对象
        ExecutorService threadPool = Executors.newCachedThreadPool();

        //提交任务
        threadPool.submit(()->{
            System.out.println(Thread.currentThread().getName() + "---执行了任务");
        });

        // 提交任务
        threadPool.submit(() -> {
            System.out.println( Thread.currentThread().getName() + "---执行了任务");
        });

        //关闭线程池
        threadPool.shutdown();



    }

}
